<!doctype html>
<meta charset=utf-8>
<title>Node.appendChild: inserting three scripts from a document fragment</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<body>
  <script>
const s1 = document.createElement("script");
const s2 = document.createElement("script");
const s3 = document.createElement("script");
const happened = [];

test(() => {
  s1.textContent = `
    s3.appendChild(new Text("happened.push('s3');"));
    happened.push("s1");
  `;
  s2.textContent = `
    happened.push("s2");
  `;
  const df = document.createDocumentFragment();
  df.appendChild(s1);
  df.appendChild(s2);
  df.appendChild(s3);

  assert_array_equals(happened, []);
  document.body.appendChild(df);
  assert_array_equals(happened, ["s3", "s1", "s2"]);
});
</script>
